﻿using SF.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SF.Ucenter.mycenterusers
{
    public partial class mywithdraw : System.Web.UI.Page
    {
        public string res,appWhere;
        Model.sf_user_info userInfo;
        BLL.sf_user_bank bankBll = new BLL.sf_user_bank();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                /*验证用户是否登录*/
                if (Session[DTKeys.SESSION_ADMIN_INFO] == null)
                {
                    Response.Redirect("index.aspx");
                }
                userInfo = Session[DTKeys.SESSION_ADMIN_INFO] as Model.sf_user_info;
                appWhere = Utils.getWhereByInfo(userInfo.busnieseNum, userInfo.appNum, userInfo.templatesNum);
            }
            string action = Request["action"] == null ? "" : Request["action"];
            switch (action)
            {
                case "checkBankNum":
                    checkBankNum();
                    break;
                default:
                    break;
            }
            int id = Request["id"] == null ? 0 : Convert.ToInt32(Request["id"]);
            getPayWay(id);
        }
        public void checkBankNum()
        {
            string num = Request["num"] == null ? "" : Request["num"];
            string str = "";
            try
            {
                str = bankBll.ExistsByNum(num, userInfo.userNum, appWhere) ? "true" : "false";
            }
            catch (Exception)
            {
                str = "";
            }

            Response.Write(str);
        }

        public void getPayWay(int id)
        {
            if (id > 0)
            {
                Model.sf_user_bank model = bankBll.GetModel(id);
                res = model == null ? "" : "^" + model.personName + "_" + model.phone + "_" + model.bankNumber + "_" + model.bankNum;
            }
        }
    }
}